package com.me.jingdongshop.ui.holder;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.me.common.ui.BaseAdapterRV;
import com.me.common.ui.BaseHolderRV;
import com.me.jingdongshop.R;
import com.me.jingdongshop.model.bean.MessageBean;

/**
 * Created by CJC on 2017/5/9.
 */

public class MessageHolder extends BaseHolderRV<MessageBean>  {

    private ImageView ivSearchItem;
    private TextView tvSearchItemTitle;
    private TextView tvSearchItemContext;

    public MessageHolder(Context context, ViewGroup parent, BaseAdapterRV adapter, int itemType) {
        super(context, parent, adapter, itemType, R.layout.search_message_center_item);
    }

    @Override
    public void onFindViews(View itemView) {
        ivSearchItem = (ImageView) itemView.findViewById(R.id.iv_search_item);
        tvSearchItemTitle = (TextView) itemView.findViewById(R.id.tv_search_item_title);
        tvSearchItemContext = (TextView) itemView.findViewById(R.id.tv_search_item_context);


    }

    @Override
    protected void onRefreshView(MessageBean bean, final int position) {
        ivSearchItem.setImageResource(bean.getPhoto());
        tvSearchItemTitle.setText(bean.getTitle());
        tvSearchItemContext.setText(bean.getContent());
        itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context,"不要点我了" + position +",不能进去了",Toast.LENGTH_SHORT).show();
            }
        });
    }
}
